﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MathTest {
    class Test6 {
        public static void getCircleArea() {
            double[] arryRadius = new double[10];
            double[] arryArea = new double[10];
            String arryString;
            Console.Write("arryRadius[]:");
            arryString = Console.ReadLine();
            string[] vals = arryString.Split(' ');

            for (int i = 0; i < vals.Length; i++) {
                Circle circle = new Circle(double.Parse(vals[i]));
                arryArea[i] = circle.getArea();
                Console.WriteLine("arryArea[" + i + "]:" + arryArea[i]);

            }


        }
        public static void saveWithLine() {
            double[] a = new double[10];

            for (int i = 0; i < a.Length; i++) {
                Console.WriteLine("输入第" + (i + 1) + "个数：");
                a[i] = double.Parse(Console.ReadLine());
                for (int m = 0; m < i; m++) {
                    if (a[i] < a[m]) {
                        double temp = a[i];
                        a[i] = a[m];
                        a[m] = temp;
                    }
                }
            }
            for (int i = 0; i < a.Length; i++) {
                Console.Write(a[i] + ",");
            }
        }

        public static void getDiagonalSum() {
            Console.WriteLine("请输入二维数组的项数n:");
            int row = int.Parse(Console.ReadLine());
            int line = row;

            int[,] arryNumber = new int[row, line];

            for (int i = 0; i < row; i++) {
                for (int j = 0; j < line; j++) {
                    Console.WriteLine("请输入第" + (i + 1) + "行第" + (j + 1) + "列数据的值：");
                    arryNumber[i, j] = int.Parse(Console.ReadLine());
                }
            }
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < line; j++) {
                    Console.Write(arryNumber[i, j] + "\t");
                }
                Console.WriteLine();
            }


            int sum = 0;
            int temp = 0;
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < line; j++) {
                    if ((i + j) == (row - 1)) {
                        sum += arryNumber[i, j];
                    }
                    if (i == j) {
                        sum += arryNumber[i, j];
                        temp = arryNumber[i, j];
                    }
                }
            }
            if (row % 2 != 0) {
                sum = sum - temp;
            }

            Console.WriteLine("数组对角线之和为：" + sum);
        }

        public static void getMinNumber() {
            Console.WriteLine("请输入二维数组的项数n:");
            int row = int.Parse(Console.ReadLine());
            int line = row;

            int[,] arryNumber = new int[row, line];

            for (int i = 0; i < row; i++) {
                for (int j = 0; j < line; j++) {
                    Console.WriteLine("请输入第" + (i + 1) + "行第" + (j + 1) + "列数据的值：");
                    arryNumber[i, j] = int.Parse(Console.ReadLine());
                }
            }
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < line; j++) {
                    Console.Write(arryNumber[i, j] + "\t");
                }
                Console.WriteLine();
            }
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < line; j++) {
                    if (arryNumber[i, j] < arryNumber[i, 0]) {
                        int temp = arryNumber[i, j];
                        arryNumber[i, j] = arryNumber[i, 0];
                        arryNumber[i, 0] = temp;
                    }
                }

            }
            for (int i = 0; i < row; i++) {
                if (arryNumber[i, 0] < arryNumber[0, 0]) {
                    int temp = arryNumber[i, 0];
                    arryNumber[i, 0] = arryNumber[0, 0];
                    arryNumber[0, 0] = temp;
                }
            }
            Console.WriteLine("既是行中最小的数又是列中最小的数是"+arryNumber[0,0]);

        }

        public static void getClassParams() {
            Student[] arryStudent = new Student[10];
            for (int i = 0; i< arryStudent.Length;i++) {
                arryStudent[i] = new Student();
                arryStudent[i].name = "小明";
                arryStudent[i].age = 17;
                arryStudent[i].phone = "18317986731";
            }
            for (int i = 0; i < arryStudent.Length; i++) {
                Console.WriteLine("姓名："+arryStudent[i].name+"年龄:"+ arryStudent[i].age+"电话："+ arryStudent[i].phone);
            }

        }
    }
}
class Circle {
    public double radius { set; get; }
    public double area { set; get; }

    public Circle(double radius) {
        this.radius = radius;
    }

    public double getArea() {
        return Math.PI * Math.Pow(radius, 2);
    }
}

class Student {
    public string name { set; get; }
    public int age { set; get; }
    public string phone { set; get; }
}
